const boxes = document.querySelectorAll('.box');

window.addEventListener('scroll',function(){
    const triggerBottom = window.innerHeight/5 *4;
    boxes.forEach(box => {
        // 获取盒子顶端位置
        const boxTop = box.getBoundingClientRect().top;
        if(boxTop < triggerBottom){
            box.classList.add('active');
        }else{
            box.classList.remove('active');
        }
    });
});